import 'package:base/main.dart';
import 'package:framework/data/datasources/home_local_repository.dart';
import 'package:framework/main.dart';
import 'package:get/get.dart';

class BannerVM extends BaseViewModel {
  final HomeRepository _repository = HomeLocalRepository();
  final RxList<String> banners = <String>[].obs;

  final RxBool isScrolling = false.obs; // 滚动状态
  final RxDouble scrollOffset = 0.0.obs; // 滚动偏移量

  void updateScrollState(double offset, bool scrolling) {
    scrollOffset.value = offset;
    isScrolling.value = scrolling;
  }

  Future<void> loadBanners() async {
    List<String> datas = await _repository.getBannerLists();
    banners.assignAll(datas);
  }

  @override
  Future<void> init() async {
    await loadBanners();
  }
}
